const Service = require('egg').Service

class BgimgService extends Service{
  async getBgimg() {
    const {ctx} = this
    let list = await this.app.model.Image.findAll()
    let id = Math.ceil((Math.random())*list.length)
    let res = list[id-1].dataValues
    // console.log(list[id-1].dataValues);
    return res
  }
}

module.exports = BgimgService